// pages/Apply_result/Apply_result.js
var call = require("../../utils/ajax.js")
var host = 'http://localhost:8085/';

Page({


    /**
     * 页面的初始数据
     */
    data: {
        adpot_message: [],
        adopt_id: "",
        level: ""
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        console.log(options)

        var adopt_id = options.adopt_id;
        var that = this;
        that.setData({
            adopt_id: adopt_id
        })
        console.log(this.data.adopt_id)
        var url = "Adopt/selectAdoptOne?adopt_id=" + adopt_id
        call.getData1(url, function(res) {
            console.log(res)
            that.setData({
                adpot_message: res.date
            })
            var hh = res.date.income_level;
            var num = "";

            function ad(hh) {
                switch (hh) {
                    case 0:
                        num = "0-2000";
                        that.setData({
                            level: num
                        })
                        console.log(that.data.level);
                        break;
                    case 1:
                        console.log(that.data.level);
                        num = "2000-5000";
                        that.setData({
                            level: num
                        })
                        break;
                    case 2:
                        console.log(that.data.level);
                        num = "5000-10000";
                        that.setData({
                            level: num
                        })
                        break;
                    case 3:
                        num = "10000以上";
                        console.log(that.data.level);
                        that.setData({
                            level: num
                        })
                        break;
                        // default:
                        //    默认代码块
                }
                console.log("ss")
                console.log("ssc")
            }
            ad(hh);

        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    }
})